import { stringify } from 'qs';
import request from '../utils/request';

/**
 * @desc 获得query
 *
 */
//数据字典主体
export async function querySysDic(params) {
  return request(`/api/sysdic?${stringify(params)}`);
}

export async function querySysDicDetail(params) {
  return request(`/api/sysdicdetail?${stringify(params)}`);
}

//部门管理
export async function querySysDepart(params) {
  return request(`/api/sysdepart?${stringify(params)}`);
}

export async function querySysDepartPerson(params) {
  return request(`/api/sysdepartperson?${stringify(params)}`);
}

//应用管理
export async function querySysAuth(params) {
  return request(`/api/sysauth?${stringify(params)}`);
}

/**
 * @desc 新增add
 */
//数据字典主体
export async function postSysDic(params) {
  return request('/api/sysdic', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function postSysDicDetail(params) {
  const {type} = params;
  const method = type==='新增'?'post':'patch';
  return request('/api/sysdicdetail', {
    method: 'POST',
    body: {
      ...params,
      method: method,
    },
  });
}

export async function postSysDepart(params) {
  console.log('service')
  console.dir(params)
  const {method} = params;
  return request('/api/sysdepart', {
    method: 'POST',
    body: {
      ...params,
      method,
    },
  });
}


// 应用管理 成员增删查改
export async function postSysDepartPerson(params) {
  const {method} = params;
  return request('/api/sysdepartperson', {
    method: 'POST',
    body: {
      ...params,
      method: method,
    },
  });
}





 /**
  * @desc 删除remove
  */
// export async function removeSysDic(params) {
//   return request('/api/SysDic', {
//     method: 'POST',
//     body: {
//       ...params,
//       method: 'delete',
//     },
//   });
// }
